# data = input() #课程名 考分
# ls = []
# # sum = 0
# while data:
#     ls.append(data.split())
#     data = input()
# ls.sort(key=lambda x:x[1], reverse=True)
# print(ls)

0,1,1,0,0
1,0,1,1,1
1,1,0,1,1
0,1,1,0,1
0,1,1,1,0
0,1,1,1,0

# list_data=['1', '4', '7']
# list_data = [int(d) for d in list_data]
# print(list_data)



#Maximum Clique Problem最大团问题
#回溯法，深度优先
import copy
def Max_Clique(t):
    global bestx #最大团节点编号
    global bestn #最大团节点数
    if t >= n:
        sum = 0
        for value in x:
            sum = sum + value
        if sum > bestn:
            bestx = copy.deepcopy(x)
            bestn = sum
    else:
        #判断与当前节点是否形成团
        flag = 1
        for i in range(0,t):
            if x[i] == 1 and G_list[t][i] == '0':
                flag = 0
        if flag == 0:
            x[t] = 0
            Max_Clique(t+1)
        else:
            for j in range(0,2):
                x[t] = j
                Max_Clique(t+1)

if __name__ == '__main__':
    #输入一个图，用二维数组存储
    #输入节点数量
    G_list = []
    data = input()
    try:
        while data:
            G_list.append(data.split(','))
            data = input()
    except EOFError as e:
        print()

    finally:

        a = G_list
        n = len(a)
        x = [i for i in range(n)]
        bestx = None
        bestn = 0
        Max_Clique(0)
        print("最大团顶点个数：", bestn)
        print("最大团为：", bestx)